package com.cmb.lk50.config;

import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.HashMap;
import java.util.Map;

/**
 * Author       : 蒋俊钊 80256973
 * Date         : 2019/8/19
 * Copyright    (C) ChinaMerchantsBank
*/
@ConfigurationProperties(prefix = LogInProperties.ACCESS_LOG_PREFIX)
public class LogInProperties {

    static final String ACCESS_LOG_PREFIX = "access-log";

    private boolean enable;

    private Map<String, Object> sinks = new HashMap<>();

    public boolean isEnable() {
        return enable;
    }

    public void setEnable(boolean enable) {
        this.enable = enable;
    }

    public Map<String, Object> getSinks() {
        return sinks;
    }

    public void setSinks(Map<String, Object> sinks) {
        this.sinks = sinks;
    }

    // 成员属性在定义时初始化的，要配成静态类
    public static class EsProperties {

        private String uris;

        private String username;

        private String password;

        private String defaultIndex;

        private String defaultType;

        private boolean multiThreaded = true;

        private int connectionTimeout = 3000;

        private int readTimeout = 3000;

        public String getUris() {
            return uris;
        }

        public void setUris(String uris) {
            this.uris = uris;
        }

        public String getUsername() {
            return username;
        }

        public void setUsername(String username) {
            this.username = username;
        }

        public String getPassword() {
            return password;
        }

        public void setPassword(String password) {
            this.password = password;
        }

        public String getDefaultIndex() {
            return defaultIndex;
        }

        public void setDefaultIndex(String defaultIndex) {
            this.defaultIndex = defaultIndex;
        }

        public String getDefaultType() {
            return defaultType;
        }

        public void setDefaultType(String defaultType) {
            this.defaultType = defaultType;
        }

        public boolean isMultiThreaded() {
            return multiThreaded;
        }

        public void setMultiThreaded(boolean multiThreaded) {
            this.multiThreaded = multiThreaded;
        }

        public int getConnectionTimeout() {
            return connectionTimeout;
        }

        public void setConnectionTimeout(int connectionTimeout) {
            this.connectionTimeout = connectionTimeout;
        }

        public int getReadTimeout() {
            return readTimeout;
        }

        public void setReadTimeout(int readTimeout) {
            this.readTimeout = readTimeout;
        }
    }

    public class JdbcProperties {
        private String url;

        private String username;

        private String password;

        private String driverClassName;

        public String getUrl() {
            return url;
        }

        public void setUrl(String url) {
            this.url = url;
        }

        public String getUsername() {
            return username;
        }

        public void setUsername(String username) {
            this.username = username;
        }

        public String getPassword() {
            return password;
        }

        public void setPassword(String password) {
            this.password = password;
        }

        public String getDriverClassName() {
            return driverClassName;
        }

        public void setDriverClassName(String driverClassName) {
            this.driverClassName = driverClassName;
        }
    }

    public class MongodbProperties {
        private String uri;

        private String database;

        private String defaultCollection;

        public String getUri() {
            return uri;
        }

        public void setUri(String uri) {
            this.uri = uri;
        }

        public String getDatabase() {
            return database;
        }

        public void setDatabase(String database) {
            this.database = database;
        }

        public String getDefaultCollection() {
            return defaultCollection;
        }

        public void setDefaultCollection(String defaultCollection) {
            this.defaultCollection = defaultCollection;
        }
    }
}
